package com.easygoods.request;

import com.bestvike.stone.spring.exception.AssertUtils;
import com.bestvike.stone.spring.rest.IRequest;
import com.easygoods.enums.AddressType;
import com.easygoods.enums.YNEnum;
import lombok.Data;

/**
 * @author zhq
 * @date 2019/1/9
 */
@Data
public class AddressAddRequest implements IRequest {
    private String provinceId;//省编码
    private String provinceName;//省名称
    private String cityId;//市编码
    private String cityName;//市名称
    private String countyId;//区编码
    private String countyName;//区名称
    private String townId;//镇编码
    private String townName;//镇名称
    private String detailedAddress;
    private String contactPerson;
    private String contactMobile;
    private AddressType addressType;
    private String addressTag;
    private YNEnum defaultAddress;

    @Override
    public void assertValid() {
        AssertUtils.hasText(this.provinceId, "provinceId");
        AssertUtils.hasText(this.provinceName, "provinceName");
        AssertUtils.hasText(this.cityId, "cityId");
        AssertUtils.hasText(this.cityName, "cityName");
        AssertUtils.hasText(this.countyId, "countyId");
        AssertUtils.hasText(this.countyName, "countyName");
        AssertUtils.hasText(this.detailedAddress, "detailedAddress");
        AssertUtils.hasText(this.contactPerson, "contactPerson");
        AssertUtils.hasText(this.contactMobile, "contactMobile");
        AssertUtils.notNull(this.addressType, "addressType");
        AssertUtils.notNull(this.defaultAddress, "defaultAddress");
    }
}
